package com.tangzhe.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class JstlServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("sdgdgsdf");
        request.setAttribute("test", "Hello Jsp");
        request.setAttribute("age", 24);
        List<String> list = new ArrayList<String>();
        list.add("1");
        list.add("3");
        list.add("5");
        request.setAttribute("list", list);

        //请求转发
        request.getRequestDispatcher("/WEB-INF/demo2.jsp").forward(request, response);
    }
}
